using System.Collections.Generic;
using UnityEngine;

namespace PKGames.Localization
{
	public class LocalizationData : ScriptableObject
	{
		private string _localizationCollectionPath = "LocalizationCollectionPath";

		public List<string> _supportedLanguages;

		public List<LocalizationEntry> _data;

		public string LocalizationCollectionPath
		{
			get
			{
				return _localizationCollectionPath;
			}
			set
			{
				_localizationCollectionPath = value;
			}
		}

		public List<string> SupportedLanguages
		{
			get
			{
				return _supportedLanguages;
			}
			set
			{
				_supportedLanguages = value;
			}
		}

		public List<LocalizationEntry> Data
		{
			get
			{
				return _data;
			}
			set
			{
				_data = value;
			}
		}

		public void AddLanguages(List<string> languages)
		{
			_supportedLanguages = languages;
			_data = new List<LocalizationEntry>();
		}

		public void AddEntry(string key, List<string> content)
		{
			if (content.Count == _supportedLanguages.Count)
			{
				LocalizationEntry localizationEntry = new LocalizationEntry();
				localizationEntry.Key = key;
				localizationEntry.Value = content;
				_data.Add(localizationEntry);
			}
			else
			{
				UnityEngine.Debug.LogError("Trying to add wrong entry.");
			}
		}
	}
}
